<!-- Web Upload Account Create PHP File -->
<!-- Reveions History ...
	Rev 1.00 at 2015/06/08 by Max Yin:
		1. First time create
	Rev 1.01 at 2015/07/08 by Max Yin:
		1. 由標楷體, 改成新細明體
-->
<html>
	<body background="pic/background_06.gif">
	<head>
		<font face="新細明體,time new roman,Arial">
		<meta charset="UTF-8">
	</head>
	<body>
		<center>
			<?php
				require_once('class_package/common.php');
				$create_password1 = $_POST['accout_password1'];
				$create_password2 = $_POST['accout_password2'];
				$isadmin=$_POST['admin'];
				if ( $create_password1 != $create_password2 ) {
					echo "<script>alert('输入的密码与再次确认密码栏位不一致, 请重新输入...');history.go(-1);</script>";
					exit();
				}
				
				// To setting username & password ...
				if ( $_COOKIE['seach_user'] == 'all' ) { 
					$create_username = $_POST['accout_username'];
				} else {
					if ( $_POST['accout_username'] != $_COOKIE['seach_user'] ) {
						echo "<script>alert('查询名称与修改人员不一致, 请重新输入...');history.go(-3);</script>";
						exit();
					}
					$create_username = $_COOKIE['seach_user'];
				}
				$admin=0;
				if($isadmin=='true'){
					$admin=1;
				}
				// To create the account user name and password to MySQL ...
				date_default_timezone_set("Asia/Taipei");	// 定义时区为 亚洲/台北
				$ceate_date = date('Y-m-d G:i:s');			// 定义显示时间格式 2015-06-14 14:24:30
				$create_by = $_COOKIE['login_user'];
				if ( $create_by == '' ) {
					echo "<script>alert('登入帐号不能为空值, 请回到 http://webdl.joytech.com.cn/webul_login.html 使用者登入网页, 重新登入!');history.go(-1);</script>";
					exit();
				}
				
				$result = account_update($create_username,$create_password1,$ceate_date,$create_by,$admin);
				if ( $result )
					echo "<script>alert('该帐号, 已修改成功!');history.go(-3);</script>";
				else
					echo "<script>alert('该帐号, 修改失败! 请联系程式开发人员, 并查明原因...');history.go(-3);</script>";
				
				exit();
			?>
		</center>
	</body>
</html>

